/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.produccion.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author carlosdavid
 */
@Entity
@Table(name = "planilla", catalog = "base_prod", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Planilla.findAll", query = "SELECT p FROM Planilla p"),
    @NamedQuery(name = "Planilla.findByIdPlanilla", query = "SELECT p FROM Planilla p WHERE p.idPlanilla = :idPlanilla"),
    @NamedQuery(name = "Planilla.findByPlanilla", query = "SELECT p FROM Planilla p WHERE p.planilla = :planilla"),
    @NamedQuery(name = "Planilla.findByPeriodo", query = "SELECT p FROM Planilla p WHERE p.periodo = :periodo"),
    @NamedQuery(name = "Planilla.findByFecha", query = "SELECT p FROM Planilla p WHERE p.fecha = :fecha"),
    @NamedQuery(name = "Planilla.findByIdUsuario", query = "SELECT p FROM Planilla p WHERE p.idUsuario = :idUsuario"),
    @NamedQuery(name = "Planilla.findByFechaMod", query = "SELECT p FROM Planilla p WHERE p.fechaMod = :fechaMod"),
    @NamedQuery(name = "Planilla.findByTipoProduccion", query = "SELECT p FROM Planilla p WHERE p.tipoProduccion = :tipoProduccion")})
public class Planilla implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idPlanilla", nullable = false)
    private Integer idPlanilla;
    @Column(name = "planilla", length = 15)
    private String planilla;
    @Column(name = "periodo", length = 6)
    private String periodo;
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Column(name = "idUsuario", length = 15)
    private String idUsuario;
    @Column(name = "fechaMod")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaMod;
    @Column(name = "tipoProduccion", length = 2)
    private String tipoProduccion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPlanilla")
    private List<PlanillaDetalle> planillaDetalleList;

    public Planilla() {
    }

    public Planilla(Integer idPlanilla) {
        this.idPlanilla = idPlanilla;
    }

    public Integer getIdPlanilla() {
        return idPlanilla;
    }

    public void setIdPlanilla(Integer idPlanilla) {
        this.idPlanilla = idPlanilla;
    }

    public String getPlanilla() {
        return planilla;
    }

    public void setPlanilla(String planilla) {
        this.planilla = planilla;
    }

    public String getPeriodo() {
        return periodo;
    }

    public void setPeriodo(String periodo) {
        this.periodo = periodo;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getIdUsuario() {
        return idUsuario;
    }

    public void setIdUsuario(String idUsuario) {
        this.idUsuario = idUsuario;
    }

    public Date getFechaMod() {
        return fechaMod;
    }

    public void setFechaMod(Date fechaMod) {
        this.fechaMod = fechaMod;
    }

    public String getTipoProduccion() {
        return tipoProduccion;
    }

    public void setTipoProduccion(String tipoProduccion) {
        this.tipoProduccion = tipoProduccion;
    }

    @XmlTransient
    @JsonIgnore
    public List<PlanillaDetalle> getPlanillaDetalleList() {
        return planillaDetalleList;
    }

    public void setPlanillaDetalleList(List<PlanillaDetalle> planillaDetalleList) {
        this.planillaDetalleList = planillaDetalleList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPlanilla != null ? idPlanilla.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Planilla)) {
            return false;
        }
        Planilla other = (Planilla) object;
        if ((this.idPlanilla == null && other.idPlanilla != null) || (this.idPlanilla != null && !this.idPlanilla.equals(other.idPlanilla))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.produccion.entity.Planilla[ idPlanilla=" + idPlanilla + " ]";
    }
    
}
